{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#时间操作[python 中的 另一个时间函数]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib notebook \n",
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "dt=datetime.datetime(year=2018,month=2,day=24,hour=11,minute=18)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2018, 2, 24, 11, 18)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2018-02-24 11:18:00\n"
     ]
    }
   ],
   "source": [
    "print(dt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#使用pandas库时间序列函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#使用时间戳"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2018-02-24 00:00:00')"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts=pd.Timestamp('2018-2-24')\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#使用属性操作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2018"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.hour"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.week"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "24"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#时间戳进行+-运算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#help(pd.Timedelta)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2018-03-01 00:00:00')"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts+pd.Timedelta(\"5 days\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#将字符串转为timestamp类型:to_datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2018-02-24 00:00:00')"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.to_datetime(\"2018-2-24\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2018-02-24 00:00:00')"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.to_datetime(\"24/2/2018\") #顺序不能错误"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 我们使用时间戳做统计分析，一般我们自动构建一个series[]进行处理,一般我们可以构建一个随机序列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "s=pd.Series(pd.date_range(start=\"2018-2-24\",periods=10,freq=\"12H\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0   2018-02-24 00:00:00\n",
       "1   2018-02-24 12:00:00\n",
       "2   2018-02-25 00:00:00\n",
       "3   2018-02-25 12:00:00\n",
       "4   2018-02-26 00:00:00\n",
       "5   2018-02-26 12:00:00\n",
       "6   2018-02-27 00:00:00\n",
       "7   2018-02-27 12:00:00\n",
       "8   2018-02-28 00:00:00\n",
       "9   2018-02-28 12:00:00\n",
       "dtype: datetime64[ns]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 时间样本读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df=pd.read_csv('./data/flowdata.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 11697 entries, 0 to 11696\n",
      "Data columns (total 4 columns):\n",
      "Time        11697 non-null object\n",
      "L06_347     11696 non-null float64\n",
      "LS06_347    11425 non-null float64\n",
      "LS06_348    10689 non-null float64\n",
      "dtypes: float64(3), object(1)\n",
      "memory usage: 365.6+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 一般来说如果我们样本中存在时间字段，我们一般设置为键，并且为时间类型进行处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df['Time']=pd.to_datetime(df['Time'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 11697 entries, 0 to 11696\n",
      "Data columns (total 4 columns):\n",
      "Time        11697 non-null datetime64[ns]\n",
      "L06_347     11696 non-null float64\n",
      "LS06_347    11425 non-null float64\n",
      "LS06_348    10689 non-null float64\n",
      "dtypes: datetime64[ns](1), float64(3)\n",
      "memory usage: 365.6 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=11697, step=1)"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df=df.set_index('Time')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01 00:00:00</th>\n",
       "      <td>0.137417</td>\n",
       "      <td>0.097500</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 03:00:00</th>\n",
       "      <td>0.131250</td>\n",
       "      <td>0.088833</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 06:00:00</th>\n",
       "      <td>0.113500</td>\n",
       "      <td>0.091250</td>\n",
       "      <td>0.016750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 09:00:00</th>\n",
       "      <td>0.135750</td>\n",
       "      <td>0.091500</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 12:00:00</th>\n",
       "      <td>0.140917</td>\n",
       "      <td>0.096167</td>\n",
       "      <td>0.017000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2009-01-01 00:00:00  0.137417  0.097500  0.016833\n",
       "2009-01-01 03:00:00  0.131250  0.088833  0.016417\n",
       "2009-01-01 06:00:00  0.113500  0.091250  0.016750\n",
       "2009-01-01 09:00:00  0.135750  0.091500  0.016250\n",
       "2009-01-01 12:00:00  0.140917  0.096167  0.017000"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 这种做法步骤有点多，能够一步到位直接解析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "data=pd.read_csv('./data/flowdata.csv',index_col=0,parse_dates=True)#这种方式很方便"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01 00:00:00</th>\n",
       "      <td>0.137417</td>\n",
       "      <td>0.097500</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 03:00:00</th>\n",
       "      <td>0.131250</td>\n",
       "      <td>0.088833</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 06:00:00</th>\n",
       "      <td>0.113500</td>\n",
       "      <td>0.091250</td>\n",
       "      <td>0.016750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 09:00:00</th>\n",
       "      <td>0.135750</td>\n",
       "      <td>0.091500</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 12:00:00</th>\n",
       "      <td>0.140917</td>\n",
       "      <td>0.096167</td>\n",
       "      <td>0.017000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2009-01-01 00:00:00  0.137417  0.097500  0.016833\n",
       "2009-01-01 03:00:00  0.131250  0.088833  0.016417\n",
       "2009-01-01 06:00:00  0.113500  0.091250  0.016750\n",
       "2009-01-01 09:00:00  0.135750  0.091500  0.016250\n",
       "2009-01-01 12:00:00  0.140917  0.096167  0.017000"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 对时间片段统计操作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 通过index 截取时间片段"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-01-01 09:00:00</th>\n",
       "      <td>0.330750</td>\n",
       "      <td>0.293583</td>\n",
       "      <td>0.029750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 12:00:00</th>\n",
       "      <td>0.295000</td>\n",
       "      <td>0.285167</td>\n",
       "      <td>0.031750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 15:00:00</th>\n",
       "      <td>0.301417</td>\n",
       "      <td>0.287750</td>\n",
       "      <td>0.031417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 18:00:00</th>\n",
       "      <td>0.322083</td>\n",
       "      <td>0.304167</td>\n",
       "      <td>0.038083</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2012-01-01 09:00:00  0.330750  0.293583  0.029750\n",
       "2012-01-01 12:00:00  0.295000  0.285167  0.031750\n",
       "2012-01-01 15:00:00  0.301417  0.287750  0.031417\n",
       "2012-01-01 18:00:00  0.322083  0.304167  0.038083"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[pd.Timestamp('2012-01-01 8:00:00'):pd.Timestamp('2012-01-01 19:00:00')]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#或者直接用str进行撸"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-01-01 09:00:00</th>\n",
       "      <td>0.330750</td>\n",
       "      <td>0.293583</td>\n",
       "      <td>0.029750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 12:00:00</th>\n",
       "      <td>0.295000</td>\n",
       "      <td>0.285167</td>\n",
       "      <td>0.031750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 15:00:00</th>\n",
       "      <td>0.301417</td>\n",
       "      <td>0.287750</td>\n",
       "      <td>0.031417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 18:00:00</th>\n",
       "      <td>0.322083</td>\n",
       "      <td>0.304167</td>\n",
       "      <td>0.038083</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2012-01-01 09:00:00  0.330750  0.293583  0.029750\n",
       "2012-01-01 12:00:00  0.295000  0.285167  0.031750\n",
       "2012-01-01 15:00:00  0.301417  0.287750  0.031417\n",
       "2012-01-01 18:00:00  0.322083  0.304167  0.038083"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['2012-01-01 8:00:00':'2012-01-01 19:00:00']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#如何获取结尾数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-12-31 21:00:00</th>\n",
       "      <td>0.846500</td>\n",
       "      <td>0.846500</td>\n",
       "      <td>0.170167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 00:00:00</th>\n",
       "      <td>1.688333</td>\n",
       "      <td>1.688333</td>\n",
       "      <td>0.207333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 03:00:00</th>\n",
       "      <td>2.693333</td>\n",
       "      <td>2.693333</td>\n",
       "      <td>0.201500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 06:00:00</th>\n",
       "      <td>2.220833</td>\n",
       "      <td>2.220833</td>\n",
       "      <td>0.166917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 09:00:00</th>\n",
       "      <td>2.055000</td>\n",
       "      <td>2.055000</td>\n",
       "      <td>0.175667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 12:00:00</th>\n",
       "      <td>1.710000</td>\n",
       "      <td>1.710000</td>\n",
       "      <td>0.129583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 15:00:00</th>\n",
       "      <td>1.420000</td>\n",
       "      <td>1.420000</td>\n",
       "      <td>0.096333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 18:00:00</th>\n",
       "      <td>1.178583</td>\n",
       "      <td>1.178583</td>\n",
       "      <td>0.083083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 21:00:00</th>\n",
       "      <td>0.898250</td>\n",
       "      <td>0.898250</td>\n",
       "      <td>0.077167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-02 00:00:00</th>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.075000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2012-12-31 21:00:00  0.846500  0.846500  0.170167\n",
       "2013-01-01 00:00:00  1.688333  1.688333  0.207333\n",
       "2013-01-01 03:00:00  2.693333  2.693333  0.201500\n",
       "2013-01-01 06:00:00  2.220833  2.220833  0.166917\n",
       "2013-01-01 09:00:00  2.055000  2.055000  0.175667\n",
       "2013-01-01 12:00:00  1.710000  1.710000  0.129583\n",
       "2013-01-01 15:00:00  1.420000  1.420000  0.096333\n",
       "2013-01-01 18:00:00  1.178583  1.178583  0.083083\n",
       "2013-01-01 21:00:00  0.898250  0.898250  0.077167\n",
       "2013-01-02 00:00:00  0.860000  0.860000  0.075000"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.tail(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#获取某一个Y，D，H"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2013-01-01 00:00:00</th>\n",
       "      <td>1.688333</td>\n",
       "      <td>1.688333</td>\n",
       "      <td>0.207333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 03:00:00</th>\n",
       "      <td>2.693333</td>\n",
       "      <td>2.693333</td>\n",
       "      <td>0.201500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 06:00:00</th>\n",
       "      <td>2.220833</td>\n",
       "      <td>2.220833</td>\n",
       "      <td>0.166917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 09:00:00</th>\n",
       "      <td>2.055000</td>\n",
       "      <td>2.055000</td>\n",
       "      <td>0.175667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 12:00:00</th>\n",
       "      <td>1.710000</td>\n",
       "      <td>1.710000</td>\n",
       "      <td>0.129583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 15:00:00</th>\n",
       "      <td>1.420000</td>\n",
       "      <td>1.420000</td>\n",
       "      <td>0.096333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 18:00:00</th>\n",
       "      <td>1.178583</td>\n",
       "      <td>1.178583</td>\n",
       "      <td>0.083083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 21:00:00</th>\n",
       "      <td>0.898250</td>\n",
       "      <td>0.898250</td>\n",
       "      <td>0.077167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-02 00:00:00</th>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.075000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2013-01-01 00:00:00  1.688333  1.688333  0.207333\n",
       "2013-01-01 03:00:00  2.693333  2.693333  0.201500\n",
       "2013-01-01 06:00:00  2.220833  2.220833  0.166917\n",
       "2013-01-01 09:00:00  2.055000  2.055000  0.175667\n",
       "2013-01-01 12:00:00  1.710000  1.710000  0.129583\n",
       "2013-01-01 15:00:00  1.420000  1.420000  0.096333\n",
       "2013-01-01 18:00:00  1.178583  1.178583  0.083083\n",
       "2013-01-01 21:00:00  0.898250  0.898250  0.077167\n",
       "2013-01-02 00:00:00  0.860000  0.860000  0.075000"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['2013']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-01-01 00:00:00</th>\n",
       "      <td>0.307167</td>\n",
       "      <td>0.273917</td>\n",
       "      <td>0.028000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 03:00:00</th>\n",
       "      <td>0.302917</td>\n",
       "      <td>0.270833</td>\n",
       "      <td>0.030583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 06:00:00</th>\n",
       "      <td>0.331500</td>\n",
       "      <td>0.284750</td>\n",
       "      <td>0.030917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 09:00:00</th>\n",
       "      <td>0.330750</td>\n",
       "      <td>0.293583</td>\n",
       "      <td>0.029750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 12:00:00</th>\n",
       "      <td>0.295000</td>\n",
       "      <td>0.285167</td>\n",
       "      <td>0.031750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 15:00:00</th>\n",
       "      <td>0.301417</td>\n",
       "      <td>0.287750</td>\n",
       "      <td>0.031417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 18:00:00</th>\n",
       "      <td>0.322083</td>\n",
       "      <td>0.304167</td>\n",
       "      <td>0.038083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 21:00:00</th>\n",
       "      <td>0.355417</td>\n",
       "      <td>0.346500</td>\n",
       "      <td>0.080917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 00:00:00</th>\n",
       "      <td>1.069333</td>\n",
       "      <td>0.970000</td>\n",
       "      <td>0.071917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 03:00:00</th>\n",
       "      <td>0.886667</td>\n",
       "      <td>0.817417</td>\n",
       "      <td>0.070833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 06:00:00</th>\n",
       "      <td>1.231000</td>\n",
       "      <td>1.153083</td>\n",
       "      <td>0.150750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 09:00:00</th>\n",
       "      <td>1.647500</td>\n",
       "      <td>1.476667</td>\n",
       "      <td>0.076583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 12:00:00</th>\n",
       "      <td>1.111000</td>\n",
       "      <td>1.003833</td>\n",
       "      <td>0.062250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 15:00:00</th>\n",
       "      <td>0.738833</td>\n",
       "      <td>0.727083</td>\n",
       "      <td>0.052417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 18:00:00</th>\n",
       "      <td>0.641250</td>\n",
       "      <td>0.603417</td>\n",
       "      <td>0.047667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-02 21:00:00</th>\n",
       "      <td>0.541917</td>\n",
       "      <td>0.537250</td>\n",
       "      <td>0.045083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 00:00:00</th>\n",
       "      <td>0.484333</td>\n",
       "      <td>0.490750</td>\n",
       "      <td>0.043000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 03:00:00</th>\n",
       "      <td>0.469417</td>\n",
       "      <td>0.443583</td>\n",
       "      <td>0.041833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 06:00:00</th>\n",
       "      <td>0.472417</td>\n",
       "      <td>0.423500</td>\n",
       "      <td>0.042333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 09:00:00</th>\n",
       "      <td>0.474583</td>\n",
       "      <td>0.416000</td>\n",
       "      <td>0.043333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 12:00:00</th>\n",
       "      <td>0.460083</td>\n",
       "      <td>0.413667</td>\n",
       "      <td>0.043583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 15:00:00</th>\n",
       "      <td>0.792833</td>\n",
       "      <td>0.695917</td>\n",
       "      <td>0.209833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 18:00:00</th>\n",
       "      <td>2.400000</td>\n",
       "      <td>2.260000</td>\n",
       "      <td>0.113583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-03 21:00:00</th>\n",
       "      <td>1.792500</td>\n",
       "      <td>1.649167</td>\n",
       "      <td>0.070167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-04 00:00:00</th>\n",
       "      <td>1.011333</td>\n",
       "      <td>0.915000</td>\n",
       "      <td>0.059167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-04 03:00:00</th>\n",
       "      <td>0.773667</td>\n",
       "      <td>0.719083</td>\n",
       "      <td>0.056583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-04 06:00:00</th>\n",
       "      <td>0.689417</td>\n",
       "      <td>0.601417</td>\n",
       "      <td>0.049083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-04 09:00:00</th>\n",
       "      <td>0.567000</td>\n",
       "      <td>0.541000</td>\n",
       "      <td>0.044083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-04 12:00:00</th>\n",
       "      <td>0.521333</td>\n",
       "      <td>0.492750</td>\n",
       "      <td>0.042500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-04 15:00:00</th>\n",
       "      <td>0.472333</td>\n",
       "      <td>0.439083</td>\n",
       "      <td>0.041167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-26 06:00:00</th>\n",
       "      <td>0.091000</td>\n",
       "      <td>0.151750</td>\n",
       "      <td>0.014500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-26 09:00:00</th>\n",
       "      <td>0.126333</td>\n",
       "      <td>0.151833</td>\n",
       "      <td>0.017583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-26 12:00:00</th>\n",
       "      <td>0.129833</td>\n",
       "      <td>0.150250</td>\n",
       "      <td>0.016167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-26 15:00:00</th>\n",
       "      <td>0.118917</td>\n",
       "      <td>0.147250</td>\n",
       "      <td>0.016083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-26 18:00:00</th>\n",
       "      <td>0.088500</td>\n",
       "      <td>0.147333</td>\n",
       "      <td>0.013417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-26 21:00:00</th>\n",
       "      <td>0.074000</td>\n",
       "      <td>0.145083</td>\n",
       "      <td>0.012583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 00:00:00</th>\n",
       "      <td>0.088250</td>\n",
       "      <td>0.142833</td>\n",
       "      <td>0.013583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 03:00:00</th>\n",
       "      <td>0.105250</td>\n",
       "      <td>0.141500</td>\n",
       "      <td>0.014667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 06:00:00</th>\n",
       "      <td>0.098667</td>\n",
       "      <td>0.141333</td>\n",
       "      <td>0.015417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 09:00:00</th>\n",
       "      <td>0.119250</td>\n",
       "      <td>0.141000</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 12:00:00</th>\n",
       "      <td>0.110583</td>\n",
       "      <td>0.142667</td>\n",
       "      <td>0.015750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 15:00:00</th>\n",
       "      <td>0.119750</td>\n",
       "      <td>0.143833</td>\n",
       "      <td>0.016167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 18:00:00</th>\n",
       "      <td>0.116833</td>\n",
       "      <td>0.142667</td>\n",
       "      <td>0.016167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-27 21:00:00</th>\n",
       "      <td>0.121583</td>\n",
       "      <td>0.143750</td>\n",
       "      <td>0.015417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 00:00:00</th>\n",
       "      <td>0.120667</td>\n",
       "      <td>0.141500</td>\n",
       "      <td>0.016583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 03:00:00</th>\n",
       "      <td>0.118083</td>\n",
       "      <td>0.139583</td>\n",
       "      <td>0.015000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 06:00:00</th>\n",
       "      <td>0.116583</td>\n",
       "      <td>0.139417</td>\n",
       "      <td>0.015000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 09:00:00</th>\n",
       "      <td>0.118250</td>\n",
       "      <td>0.139000</td>\n",
       "      <td>0.015917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 12:00:00</th>\n",
       "      <td>0.122167</td>\n",
       "      <td>0.139500</td>\n",
       "      <td>0.015250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 15:00:00</th>\n",
       "      <td>0.110000</td>\n",
       "      <td>0.134833</td>\n",
       "      <td>0.015583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 18:00:00</th>\n",
       "      <td>0.098833</td>\n",
       "      <td>0.134333</td>\n",
       "      <td>0.015917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-28 21:00:00</th>\n",
       "      <td>0.099250</td>\n",
       "      <td>0.134583</td>\n",
       "      <td>0.015167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 00:00:00</th>\n",
       "      <td>0.093500</td>\n",
       "      <td>0.132333</td>\n",
       "      <td>0.013250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 03:00:00</th>\n",
       "      <td>0.097333</td>\n",
       "      <td>0.130917</td>\n",
       "      <td>0.013333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 06:00:00</th>\n",
       "      <td>0.096833</td>\n",
       "      <td>0.129917</td>\n",
       "      <td>0.014000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 09:00:00</th>\n",
       "      <td>0.106667</td>\n",
       "      <td>0.132250</td>\n",
       "      <td>0.015167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 12:00:00</th>\n",
       "      <td>0.114000</td>\n",
       "      <td>0.133083</td>\n",
       "      <td>0.014667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 15:00:00</th>\n",
       "      <td>0.106250</td>\n",
       "      <td>0.131500</td>\n",
       "      <td>0.015083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 18:00:00</th>\n",
       "      <td>0.095250</td>\n",
       "      <td>0.129000</td>\n",
       "      <td>0.014917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-02-29 21:00:00</th>\n",
       "      <td>0.093000</td>\n",
       "      <td>0.130083</td>\n",
       "      <td>0.015167</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>480 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2012-01-01 00:00:00  0.307167  0.273917  0.028000\n",
       "2012-01-01 03:00:00  0.302917  0.270833  0.030583\n",
       "2012-01-01 06:00:00  0.331500  0.284750  0.030917\n",
       "2012-01-01 09:00:00  0.330750  0.293583  0.029750\n",
       "2012-01-01 12:00:00  0.295000  0.285167  0.031750\n",
       "2012-01-01 15:00:00  0.301417  0.287750  0.031417\n",
       "2012-01-01 18:00:00  0.322083  0.304167  0.038083\n",
       "2012-01-01 21:00:00  0.355417  0.346500  0.080917\n",
       "2012-01-02 00:00:00  1.069333  0.970000  0.071917\n",
       "2012-01-02 03:00:00  0.886667  0.817417  0.070833\n",
       "2012-01-02 06:00:00  1.231000  1.153083  0.150750\n",
       "2012-01-02 09:00:00  1.647500  1.476667  0.076583\n",
       "2012-01-02 12:00:00  1.111000  1.003833  0.062250\n",
       "2012-01-02 15:00:00  0.738833  0.727083  0.052417\n",
       "2012-01-02 18:00:00  0.641250  0.603417  0.047667\n",
       "2012-01-02 21:00:00  0.541917  0.537250  0.045083\n",
       "2012-01-03 00:00:00  0.484333  0.490750  0.043000\n",
       "2012-01-03 03:00:00  0.469417  0.443583  0.041833\n",
       "2012-01-03 06:00:00  0.472417  0.423500  0.042333\n",
       "2012-01-03 09:00:00  0.474583  0.416000  0.043333\n",
       "2012-01-03 12:00:00  0.460083  0.413667  0.043583\n",
       "2012-01-03 15:00:00  0.792833  0.695917  0.209833\n",
       "2012-01-03 18:00:00  2.400000  2.260000  0.113583\n",
       "2012-01-03 21:00:00  1.792500  1.649167  0.070167\n",
       "2012-01-04 00:00:00  1.011333  0.915000  0.059167\n",
       "2012-01-04 03:00:00  0.773667  0.719083  0.056583\n",
       "2012-01-04 06:00:00  0.689417  0.601417  0.049083\n",
       "2012-01-04 09:00:00  0.567000  0.541000  0.044083\n",
       "2012-01-04 12:00:00  0.521333  0.492750  0.042500\n",
       "2012-01-04 15:00:00  0.472333  0.439083  0.041167\n",
       "...                       ...       ...       ...\n",
       "2012-02-26 06:00:00  0.091000  0.151750  0.014500\n",
       "2012-02-26 09:00:00  0.126333  0.151833  0.017583\n",
       "2012-02-26 12:00:00  0.129833  0.150250  0.016167\n",
       "2012-02-26 15:00:00  0.118917  0.147250  0.016083\n",
       "2012-02-26 18:00:00  0.088500  0.147333  0.013417\n",
       "2012-02-26 21:00:00  0.074000  0.145083  0.012583\n",
       "2012-02-27 00:00:00  0.088250  0.142833  0.013583\n",
       "2012-02-27 03:00:00  0.105250  0.141500  0.014667\n",
       "2012-02-27 06:00:00  0.098667  0.141333  0.015417\n",
       "2012-02-27 09:00:00  0.119250  0.141000  0.016250\n",
       "2012-02-27 12:00:00  0.110583  0.142667  0.015750\n",
       "2012-02-27 15:00:00  0.119750  0.143833  0.016167\n",
       "2012-02-27 18:00:00  0.116833  0.142667  0.016167\n",
       "2012-02-27 21:00:00  0.121583  0.143750  0.015417\n",
       "2012-02-28 00:00:00  0.120667  0.141500  0.016583\n",
       "2012-02-28 03:00:00  0.118083  0.139583  0.015000\n",
       "2012-02-28 06:00:00  0.116583  0.139417  0.015000\n",
       "2012-02-28 09:00:00  0.118250  0.139000  0.015917\n",
       "2012-02-28 12:00:00  0.122167  0.139500  0.015250\n",
       "2012-02-28 15:00:00  0.110000  0.134833  0.015583\n",
       "2012-02-28 18:00:00  0.098833  0.134333  0.015917\n",
       "2012-02-28 21:00:00  0.099250  0.134583  0.015167\n",
       "2012-02-29 00:00:00  0.093500  0.132333  0.013250\n",
       "2012-02-29 03:00:00  0.097333  0.130917  0.013333\n",
       "2012-02-29 06:00:00  0.096833  0.129917  0.014000\n",
       "2012-02-29 09:00:00  0.106667  0.132250  0.015167\n",
       "2012-02-29 12:00:00  0.114000  0.133083  0.014667\n",
       "2012-02-29 15:00:00  0.106250  0.131500  0.015083\n",
       "2012-02-29 18:00:00  0.095250  0.129000  0.014917\n",
       "2012-02-29 21:00:00  0.093000  0.130083  0.015167\n",
       "\n",
       "[480 rows x 3 columns]"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['2012-01':'2012-02']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#通过index方式获取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01 00:00:00</th>\n",
       "      <td>0.137417</td>\n",
       "      <td>0.097500</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 03:00:00</th>\n",
       "      <td>0.131250</td>\n",
       "      <td>0.088833</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 06:00:00</th>\n",
       "      <td>0.113500</td>\n",
       "      <td>0.091250</td>\n",
       "      <td>0.016750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 09:00:00</th>\n",
       "      <td>0.135750</td>\n",
       "      <td>0.091500</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 12:00:00</th>\n",
       "      <td>0.140917</td>\n",
       "      <td>0.096167</td>\n",
       "      <td>0.017000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 15:00:00</th>\n",
       "      <td>0.099167</td>\n",
       "      <td>0.091667</td>\n",
       "      <td>0.017583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 18:00:00</th>\n",
       "      <td>0.132667</td>\n",
       "      <td>0.090167</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 21:00:00</th>\n",
       "      <td>0.109417</td>\n",
       "      <td>0.091167</td>\n",
       "      <td>0.016000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 00:00:00</th>\n",
       "      <td>0.133833</td>\n",
       "      <td>0.090417</td>\n",
       "      <td>0.016083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 03:00:00</th>\n",
       "      <td>0.092083</td>\n",
       "      <td>0.088667</td>\n",
       "      <td>0.016000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 06:00:00</th>\n",
       "      <td>0.112917</td>\n",
       "      <td>0.091417</td>\n",
       "      <td>0.016333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 09:00:00</th>\n",
       "      <td>0.141917</td>\n",
       "      <td>0.097083</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 12:00:00</th>\n",
       "      <td>0.147833</td>\n",
       "      <td>0.101917</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 15:00:00</th>\n",
       "      <td>0.107917</td>\n",
       "      <td>0.100250</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 18:00:00</th>\n",
       "      <td>0.143583</td>\n",
       "      <td>0.098417</td>\n",
       "      <td>0.016750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 21:00:00</th>\n",
       "      <td>0.113083</td>\n",
       "      <td>0.098083</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 00:00:00</th>\n",
       "      <td>0.135833</td>\n",
       "      <td>0.092167</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 03:00:00</th>\n",
       "      <td>0.083250</td>\n",
       "      <td>0.080000</td>\n",
       "      <td>0.016083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 06:00:00</th>\n",
       "      <td>0.119417</td>\n",
       "      <td>0.080250</td>\n",
       "      <td>0.015417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 09:00:00</th>\n",
       "      <td>0.124583</td>\n",
       "      <td>0.084417</td>\n",
       "      <td>0.015833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 12:00:00</th>\n",
       "      <td>0.091667</td>\n",
       "      <td>0.088250</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 15:00:00</th>\n",
       "      <td>0.125000</td>\n",
       "      <td>0.084667</td>\n",
       "      <td>0.016500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 18:00:00</th>\n",
       "      <td>0.121583</td>\n",
       "      <td>0.082083</td>\n",
       "      <td>0.015833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 21:00:00</th>\n",
       "      <td>0.107167</td>\n",
       "      <td>0.092500</td>\n",
       "      <td>0.016000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 00:00:00</th>\n",
       "      <td>0.135250</td>\n",
       "      <td>0.091167</td>\n",
       "      <td>0.016333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 03:00:00</th>\n",
       "      <td>0.135583</td>\n",
       "      <td>0.091583</td>\n",
       "      <td>0.016083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 06:00:00</th>\n",
       "      <td>0.117167</td>\n",
       "      <td>0.095167</td>\n",
       "      <td>0.016000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 09:00:00</th>\n",
       "      <td>0.109000</td>\n",
       "      <td>0.105167</td>\n",
       "      <td>0.018000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 12:00:00</th>\n",
       "      <td>0.157417</td>\n",
       "      <td>0.110750</td>\n",
       "      <td>0.018417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 15:00:00</th>\n",
       "      <td>0.160417</td>\n",
       "      <td>0.113750</td>\n",
       "      <td>0.018417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-29 09:00:00</th>\n",
       "      <td>0.296833</td>\n",
       "      <td>0.315833</td>\n",
       "      <td>0.034750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-29 12:00:00</th>\n",
       "      <td>0.294000</td>\n",
       "      <td>0.311917</td>\n",
       "      <td>0.034333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-29 15:00:00</th>\n",
       "      <td>0.269500</td>\n",
       "      <td>0.308000</td>\n",
       "      <td>0.033000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-29 18:00:00</th>\n",
       "      <td>0.259417</td>\n",
       "      <td>0.304417</td>\n",
       "      <td>0.031833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-29 21:00:00</th>\n",
       "      <td>0.254583</td>\n",
       "      <td>0.296250</td>\n",
       "      <td>0.031333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 00:00:00</th>\n",
       "      <td>0.243500</td>\n",
       "      <td>0.287333</td>\n",
       "      <td>0.030917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 03:00:00</th>\n",
       "      <td>0.236250</td>\n",
       "      <td>0.281667</td>\n",
       "      <td>0.030250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 06:00:00</th>\n",
       "      <td>0.230333</td>\n",
       "      <td>0.272167</td>\n",
       "      <td>0.029417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 09:00:00</th>\n",
       "      <td>0.221833</td>\n",
       "      <td>0.263250</td>\n",
       "      <td>0.027833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 12:00:00</th>\n",
       "      <td>0.224250</td>\n",
       "      <td>0.262583</td>\n",
       "      <td>0.029250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 15:00:00</th>\n",
       "      <td>0.206000</td>\n",
       "      <td>0.256750</td>\n",
       "      <td>0.028917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 18:00:00</th>\n",
       "      <td>0.200417</td>\n",
       "      <td>0.258417</td>\n",
       "      <td>0.028250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-30 21:00:00</th>\n",
       "      <td>0.192750</td>\n",
       "      <td>0.251083</td>\n",
       "      <td>0.027250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 00:00:00</th>\n",
       "      <td>0.191250</td>\n",
       "      <td>0.247417</td>\n",
       "      <td>0.025917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 03:00:00</th>\n",
       "      <td>0.181083</td>\n",
       "      <td>0.241583</td>\n",
       "      <td>0.025833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 06:00:00</th>\n",
       "      <td>0.188750</td>\n",
       "      <td>0.236750</td>\n",
       "      <td>0.026000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 09:00:00</th>\n",
       "      <td>0.191000</td>\n",
       "      <td>0.231250</td>\n",
       "      <td>0.025583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 12:00:00</th>\n",
       "      <td>0.183333</td>\n",
       "      <td>0.227167</td>\n",
       "      <td>0.025917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 15:00:00</th>\n",
       "      <td>0.163417</td>\n",
       "      <td>0.221000</td>\n",
       "      <td>0.023750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 18:00:00</th>\n",
       "      <td>0.157083</td>\n",
       "      <td>0.220667</td>\n",
       "      <td>0.023167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-31 21:00:00</th>\n",
       "      <td>0.160083</td>\n",
       "      <td>0.214750</td>\n",
       "      <td>0.023333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 00:00:00</th>\n",
       "      <td>1.688333</td>\n",
       "      <td>1.688333</td>\n",
       "      <td>0.207333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 03:00:00</th>\n",
       "      <td>2.693333</td>\n",
       "      <td>2.693333</td>\n",
       "      <td>0.201500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 06:00:00</th>\n",
       "      <td>2.220833</td>\n",
       "      <td>2.220833</td>\n",
       "      <td>0.166917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 09:00:00</th>\n",
       "      <td>2.055000</td>\n",
       "      <td>2.055000</td>\n",
       "      <td>0.175667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 12:00:00</th>\n",
       "      <td>1.710000</td>\n",
       "      <td>1.710000</td>\n",
       "      <td>0.129583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 15:00:00</th>\n",
       "      <td>1.420000</td>\n",
       "      <td>1.420000</td>\n",
       "      <td>0.096333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 18:00:00</th>\n",
       "      <td>1.178583</td>\n",
       "      <td>1.178583</td>\n",
       "      <td>0.083083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 21:00:00</th>\n",
       "      <td>0.898250</td>\n",
       "      <td>0.898250</td>\n",
       "      <td>0.077167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-02 00:00:00</th>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.860000</td>\n",
       "      <td>0.075000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1001 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2009-01-01 00:00:00  0.137417  0.097500  0.016833\n",
       "2009-01-01 03:00:00  0.131250  0.088833  0.016417\n",
       "2009-01-01 06:00:00  0.113500  0.091250  0.016750\n",
       "2009-01-01 09:00:00  0.135750  0.091500  0.016250\n",
       "2009-01-01 12:00:00  0.140917  0.096167  0.017000\n",
       "2009-01-01 15:00:00  0.099167  0.091667  0.017583\n",
       "2009-01-01 18:00:00  0.132667  0.090167  0.016250\n",
       "2009-01-01 21:00:00  0.109417  0.091167  0.016000\n",
       "2009-01-02 00:00:00  0.133833  0.090417  0.016083\n",
       "2009-01-02 03:00:00  0.092083  0.088667  0.016000\n",
       "2009-01-02 06:00:00  0.112917  0.091417  0.016333\n",
       "2009-01-02 09:00:00  0.141917  0.097083  0.016417\n",
       "2009-01-02 12:00:00  0.147833  0.101917  0.016417\n",
       "2009-01-02 15:00:00  0.107917  0.100250  0.016417\n",
       "2009-01-02 18:00:00  0.143583  0.098417  0.016750\n",
       "2009-01-02 21:00:00  0.113083  0.098083  0.016833\n",
       "2009-01-03 00:00:00  0.135833  0.092167  0.016833\n",
       "2009-01-03 03:00:00  0.083250  0.080000  0.016083\n",
       "2009-01-03 06:00:00  0.119417  0.080250  0.015417\n",
       "2009-01-03 09:00:00  0.124583  0.084417  0.015833\n",
       "2009-01-03 12:00:00  0.091667  0.088250  0.016250\n",
       "2009-01-03 15:00:00  0.125000  0.084667  0.016500\n",
       "2009-01-03 18:00:00  0.121583  0.082083  0.015833\n",
       "2009-01-03 21:00:00  0.107167  0.092500  0.016000\n",
       "2009-01-04 00:00:00  0.135250  0.091167  0.016333\n",
       "2009-01-04 03:00:00  0.135583  0.091583  0.016083\n",
       "2009-01-04 06:00:00  0.117167  0.095167  0.016000\n",
       "2009-01-04 09:00:00  0.109000  0.105167  0.018000\n",
       "2009-01-04 12:00:00  0.157417  0.110750  0.018417\n",
       "2009-01-04 15:00:00  0.160417  0.113750  0.018417\n",
       "...                       ...       ...       ...\n",
       "2012-01-29 09:00:00  0.296833  0.315833  0.034750\n",
       "2012-01-29 12:00:00  0.294000  0.311917  0.034333\n",
       "2012-01-29 15:00:00  0.269500  0.308000  0.033000\n",
       "2012-01-29 18:00:00  0.259417  0.304417  0.031833\n",
       "2012-01-29 21:00:00  0.254583  0.296250  0.031333\n",
       "2012-01-30 00:00:00  0.243500  0.287333  0.030917\n",
       "2012-01-30 03:00:00  0.236250  0.281667  0.030250\n",
       "2012-01-30 06:00:00  0.230333  0.272167  0.029417\n",
       "2012-01-30 09:00:00  0.221833  0.263250  0.027833\n",
       "2012-01-30 12:00:00  0.224250  0.262583  0.029250\n",
       "2012-01-30 15:00:00  0.206000  0.256750  0.028917\n",
       "2012-01-30 18:00:00  0.200417  0.258417  0.028250\n",
       "2012-01-30 21:00:00  0.192750  0.251083  0.027250\n",
       "2012-01-31 00:00:00  0.191250  0.247417  0.025917\n",
       "2012-01-31 03:00:00  0.181083  0.241583  0.025833\n",
       "2012-01-31 06:00:00  0.188750  0.236750  0.026000\n",
       "2012-01-31 09:00:00  0.191000  0.231250  0.025583\n",
       "2012-01-31 12:00:00  0.183333  0.227167  0.025917\n",
       "2012-01-31 15:00:00  0.163417  0.221000  0.023750\n",
       "2012-01-31 18:00:00  0.157083  0.220667  0.023167\n",
       "2012-01-31 21:00:00  0.160083  0.214750  0.023333\n",
       "2013-01-01 00:00:00  1.688333  1.688333  0.207333\n",
       "2013-01-01 03:00:00  2.693333  2.693333  0.201500\n",
       "2013-01-01 06:00:00  2.220833  2.220833  0.166917\n",
       "2013-01-01 09:00:00  2.055000  2.055000  0.175667\n",
       "2013-01-01 12:00:00  1.710000  1.710000  0.129583\n",
       "2013-01-01 15:00:00  1.420000  1.420000  0.096333\n",
       "2013-01-01 18:00:00  1.178583  1.178583  0.083083\n",
       "2013-01-01 21:00:00  0.898250  0.898250  0.077167\n",
       "2013-01-02 00:00:00  0.860000  0.860000  0.075000\n",
       "\n",
       "[1001 rows x 3 columns]"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[data.index.month==1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#如何获取条件数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01 09:00:00</th>\n",
       "      <td>0.135750</td>\n",
       "      <td>0.091500</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 09:00:00</th>\n",
       "      <td>0.141917</td>\n",
       "      <td>0.097083</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 09:00:00</th>\n",
       "      <td>0.124583</td>\n",
       "      <td>0.084417</td>\n",
       "      <td>0.015833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 09:00:00</th>\n",
       "      <td>0.109000</td>\n",
       "      <td>0.105167</td>\n",
       "      <td>0.018000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05 09:00:00</th>\n",
       "      <td>0.161500</td>\n",
       "      <td>0.114583</td>\n",
       "      <td>0.021583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-06 09:00:00</th>\n",
       "      <td>0.100083</td>\n",
       "      <td>0.065583</td>\n",
       "      <td>0.015500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-07 09:00:00</th>\n",
       "      <td>0.138500</td>\n",
       "      <td>0.093917</td>\n",
       "      <td>0.015000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-08 09:00:00</th>\n",
       "      <td>0.101333</td>\n",
       "      <td>0.066417</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-09 09:00:00</th>\n",
       "      <td>0.061750</td>\n",
       "      <td>0.059417</td>\n",
       "      <td>0.015167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-10 09:00:00</th>\n",
       "      <td>0.193500</td>\n",
       "      <td>0.147000</td>\n",
       "      <td>0.013000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-11 09:00:00</th>\n",
       "      <td>0.080250</td>\n",
       "      <td>0.077417</td>\n",
       "      <td>0.013583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-12 09:00:00</th>\n",
       "      <td>0.132500</td>\n",
       "      <td>0.089167</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-13 09:00:00</th>\n",
       "      <td>0.196500</td>\n",
       "      <td>0.192667</td>\n",
       "      <td>0.045333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-14 09:00:00</th>\n",
       "      <td>0.322917</td>\n",
       "      <td>0.299250</td>\n",
       "      <td>0.029333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-15 09:00:00</th>\n",
       "      <td>0.210750</td>\n",
       "      <td>0.167500</td>\n",
       "      <td>0.025000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-16 09:00:00</th>\n",
       "      <td>0.157833</td>\n",
       "      <td>0.153917</td>\n",
       "      <td>0.023000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-17 09:00:00</th>\n",
       "      <td>0.218667</td>\n",
       "      <td>0.173333</td>\n",
       "      <td>0.022917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-18 09:00:00</th>\n",
       "      <td>0.633000</td>\n",
       "      <td>0.745667</td>\n",
       "      <td>0.077000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-19 09:00:00</th>\n",
       "      <td>1.042167</td>\n",
       "      <td>1.398500</td>\n",
       "      <td>0.133667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-20 09:00:00</th>\n",
       "      <td>0.753000</td>\n",
       "      <td>0.773000</td>\n",
       "      <td>0.065583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-21 09:00:00</th>\n",
       "      <td>0.398500</td>\n",
       "      <td>0.398500</td>\n",
       "      <td>0.042500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-22 09:00:00</th>\n",
       "      <td>0.362417</td>\n",
       "      <td>0.351250</td>\n",
       "      <td>0.036667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-23 09:00:00</th>\n",
       "      <td>8.237500</td>\n",
       "      <td>8.560000</td>\n",
       "      <td>0.383750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-24 09:00:00</th>\n",
       "      <td>1.857500</td>\n",
       "      <td>2.356667</td>\n",
       "      <td>0.099750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-25 09:00:00</th>\n",
       "      <td>0.575583</td>\n",
       "      <td>0.657750</td>\n",
       "      <td>0.059000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-26 09:00:00</th>\n",
       "      <td>0.305417</td>\n",
       "      <td>0.279917</td>\n",
       "      <td>0.044167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-27 09:00:00</th>\n",
       "      <td>0.279917</td>\n",
       "      <td>0.274917</td>\n",
       "      <td>0.032500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-28 09:00:00</th>\n",
       "      <td>0.287083</td>\n",
       "      <td>0.253833</td>\n",
       "      <td>0.031083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-29 09:00:00</th>\n",
       "      <td>0.260750</td>\n",
       "      <td>0.221833</td>\n",
       "      <td>0.028167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-30 09:00:00</th>\n",
       "      <td>0.242000</td>\n",
       "      <td>0.200167</td>\n",
       "      <td>0.024750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-03 09:00:00</th>\n",
       "      <td>0.144500</td>\n",
       "      <td>0.144500</td>\n",
       "      <td>0.074667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-04 09:00:00</th>\n",
       "      <td>0.292083</td>\n",
       "      <td>0.292083</td>\n",
       "      <td>0.041083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-05 09:00:00</th>\n",
       "      <td>0.775250</td>\n",
       "      <td>0.775250</td>\n",
       "      <td>0.075667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-06 09:00:00</th>\n",
       "      <td>0.467917</td>\n",
       "      <td>0.467917</td>\n",
       "      <td>0.060750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-07 09:00:00</th>\n",
       "      <td>0.509833</td>\n",
       "      <td>0.509833</td>\n",
       "      <td>0.096583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-08 09:00:00</th>\n",
       "      <td>0.457583</td>\n",
       "      <td>0.457583</td>\n",
       "      <td>0.064667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-09 09:00:00</th>\n",
       "      <td>0.288750</td>\n",
       "      <td>0.288750</td>\n",
       "      <td>0.053167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-10 09:00:00</th>\n",
       "      <td>0.289250</td>\n",
       "      <td>0.289250</td>\n",
       "      <td>0.060083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-11 09:00:00</th>\n",
       "      <td>0.226083</td>\n",
       "      <td>0.226083</td>\n",
       "      <td>0.037833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-12 09:00:00</th>\n",
       "      <td>0.201333</td>\n",
       "      <td>0.201333</td>\n",
       "      <td>0.035167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-13 09:00:00</th>\n",
       "      <td>0.175750</td>\n",
       "      <td>0.175750</td>\n",
       "      <td>0.034500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-14 09:00:00</th>\n",
       "      <td>0.165833</td>\n",
       "      <td>0.165833</td>\n",
       "      <td>0.035417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-15 09:00:00</th>\n",
       "      <td>0.576833</td>\n",
       "      <td>0.576833</td>\n",
       "      <td>0.065083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-16 09:00:00</th>\n",
       "      <td>0.381750</td>\n",
       "      <td>0.381750</td>\n",
       "      <td>0.046417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-17 09:00:00</th>\n",
       "      <td>0.305833</td>\n",
       "      <td>0.305833</td>\n",
       "      <td>0.050917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-18 09:00:00</th>\n",
       "      <td>0.302167</td>\n",
       "      <td>0.302167</td>\n",
       "      <td>0.070667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-19 09:00:00</th>\n",
       "      <td>0.282917</td>\n",
       "      <td>0.282917</td>\n",
       "      <td>0.041333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-20 09:00:00</th>\n",
       "      <td>0.306083</td>\n",
       "      <td>0.306083</td>\n",
       "      <td>0.068250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-21 09:00:00</th>\n",
       "      <td>0.550333</td>\n",
       "      <td>0.550333</td>\n",
       "      <td>0.059250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-22 09:00:00</th>\n",
       "      <td>0.378833</td>\n",
       "      <td>0.378833</td>\n",
       "      <td>0.069667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-23 09:00:00</th>\n",
       "      <td>5.917500</td>\n",
       "      <td>5.917500</td>\n",
       "      <td>0.286583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-24 09:00:00</th>\n",
       "      <td>1.638333</td>\n",
       "      <td>1.638333</td>\n",
       "      <td>0.151333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-25 09:00:00</th>\n",
       "      <td>1.719167</td>\n",
       "      <td>1.719167</td>\n",
       "      <td>0.146250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-26 09:00:00</th>\n",
       "      <td>1.354167</td>\n",
       "      <td>1.354167</td>\n",
       "      <td>0.127583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-27 09:00:00</th>\n",
       "      <td>1.076667</td>\n",
       "      <td>1.076667</td>\n",
       "      <td>0.103000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-28 09:00:00</th>\n",
       "      <td>0.961500</td>\n",
       "      <td>0.961500</td>\n",
       "      <td>0.092417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-29 09:00:00</th>\n",
       "      <td>0.786833</td>\n",
       "      <td>0.786833</td>\n",
       "      <td>0.077000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-30 09:00:00</th>\n",
       "      <td>0.916000</td>\n",
       "      <td>0.916000</td>\n",
       "      <td>0.101583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-31 09:00:00</th>\n",
       "      <td>0.682750</td>\n",
       "      <td>0.682750</td>\n",
       "      <td>0.066583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 09:00:00</th>\n",
       "      <td>2.055000</td>\n",
       "      <td>2.055000</td>\n",
       "      <td>0.175667</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1462 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2009-01-01 09:00:00  0.135750  0.091500  0.016250\n",
       "2009-01-02 09:00:00  0.141917  0.097083  0.016417\n",
       "2009-01-03 09:00:00  0.124583  0.084417  0.015833\n",
       "2009-01-04 09:00:00  0.109000  0.105167  0.018000\n",
       "2009-01-05 09:00:00  0.161500  0.114583  0.021583\n",
       "2009-01-06 09:00:00  0.100083  0.065583  0.015500\n",
       "2009-01-07 09:00:00  0.138500  0.093917  0.015000\n",
       "2009-01-08 09:00:00  0.101333  0.066417  0.016833\n",
       "2009-01-09 09:00:00  0.061750  0.059417  0.015167\n",
       "2009-01-10 09:00:00  0.193500  0.147000  0.013000\n",
       "2009-01-11 09:00:00  0.080250  0.077417  0.013583\n",
       "2009-01-12 09:00:00  0.132500  0.089167  0.016833\n",
       "2009-01-13 09:00:00  0.196500  0.192667  0.045333\n",
       "2009-01-14 09:00:00  0.322917  0.299250  0.029333\n",
       "2009-01-15 09:00:00  0.210750  0.167500  0.025000\n",
       "2009-01-16 09:00:00  0.157833  0.153917  0.023000\n",
       "2009-01-17 09:00:00  0.218667  0.173333  0.022917\n",
       "2009-01-18 09:00:00  0.633000  0.745667  0.077000\n",
       "2009-01-19 09:00:00  1.042167  1.398500  0.133667\n",
       "2009-01-20 09:00:00  0.753000  0.773000  0.065583\n",
       "2009-01-21 09:00:00  0.398500  0.398500  0.042500\n",
       "2009-01-22 09:00:00  0.362417  0.351250  0.036667\n",
       "2009-01-23 09:00:00  8.237500  8.560000  0.383750\n",
       "2009-01-24 09:00:00  1.857500  2.356667  0.099750\n",
       "2009-01-25 09:00:00  0.575583  0.657750  0.059000\n",
       "2009-01-26 09:00:00  0.305417  0.279917  0.044167\n",
       "2009-01-27 09:00:00  0.279917  0.274917  0.032500\n",
       "2009-01-28 09:00:00  0.287083  0.253833  0.031083\n",
       "2009-01-29 09:00:00  0.260750  0.221833  0.028167\n",
       "2009-01-30 09:00:00  0.242000  0.200167  0.024750\n",
       "...                       ...       ...       ...\n",
       "2012-12-03 09:00:00  0.144500  0.144500  0.074667\n",
       "2012-12-04 09:00:00  0.292083  0.292083  0.041083\n",
       "2012-12-05 09:00:00  0.775250  0.775250  0.075667\n",
       "2012-12-06 09:00:00  0.467917  0.467917  0.060750\n",
       "2012-12-07 09:00:00  0.509833  0.509833  0.096583\n",
       "2012-12-08 09:00:00  0.457583  0.457583  0.064667\n",
       "2012-12-09 09:00:00  0.288750  0.288750  0.053167\n",
       "2012-12-10 09:00:00  0.289250  0.289250  0.060083\n",
       "2012-12-11 09:00:00  0.226083  0.226083  0.037833\n",
       "2012-12-12 09:00:00  0.201333  0.201333  0.035167\n",
       "2012-12-13 09:00:00  0.175750  0.175750  0.034500\n",
       "2012-12-14 09:00:00  0.165833  0.165833  0.035417\n",
       "2012-12-15 09:00:00  0.576833  0.576833  0.065083\n",
       "2012-12-16 09:00:00  0.381750  0.381750  0.046417\n",
       "2012-12-17 09:00:00  0.305833  0.305833  0.050917\n",
       "2012-12-18 09:00:00  0.302167  0.302167  0.070667\n",
       "2012-12-19 09:00:00  0.282917  0.282917  0.041333\n",
       "2012-12-20 09:00:00  0.306083  0.306083  0.068250\n",
       "2012-12-21 09:00:00  0.550333  0.550333  0.059250\n",
       "2012-12-22 09:00:00  0.378833  0.378833  0.069667\n",
       "2012-12-23 09:00:00  5.917500  5.917500  0.286583\n",
       "2012-12-24 09:00:00  1.638333  1.638333  0.151333\n",
       "2012-12-25 09:00:00  1.719167  1.719167  0.146250\n",
       "2012-12-26 09:00:00  1.354167  1.354167  0.127583\n",
       "2012-12-27 09:00:00  1.076667  1.076667  0.103000\n",
       "2012-12-28 09:00:00  0.961500  0.961500  0.092417\n",
       "2012-12-29 09:00:00  0.786833  0.786833  0.077000\n",
       "2012-12-30 09:00:00  0.916000  0.916000  0.101583\n",
       "2012-12-31 09:00:00  0.682750  0.682750  0.066583\n",
       "2013-01-01 09:00:00  2.055000  2.055000  0.175667\n",
       "\n",
       "[1462 rows x 3 columns]"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[(data.index.hour > 8) & (data.index.hour <12)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01 09:00:00</th>\n",
       "      <td>0.135750</td>\n",
       "      <td>0.091500</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 12:00:00</th>\n",
       "      <td>0.140917</td>\n",
       "      <td>0.096167</td>\n",
       "      <td>0.017000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 15:00:00</th>\n",
       "      <td>0.099167</td>\n",
       "      <td>0.091667</td>\n",
       "      <td>0.017583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 18:00:00</th>\n",
       "      <td>0.132667</td>\n",
       "      <td>0.090167</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 09:00:00</th>\n",
       "      <td>0.141917</td>\n",
       "      <td>0.097083</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 12:00:00</th>\n",
       "      <td>0.147833</td>\n",
       "      <td>0.101917</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 15:00:00</th>\n",
       "      <td>0.107917</td>\n",
       "      <td>0.100250</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02 18:00:00</th>\n",
       "      <td>0.143583</td>\n",
       "      <td>0.098417</td>\n",
       "      <td>0.016750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 09:00:00</th>\n",
       "      <td>0.124583</td>\n",
       "      <td>0.084417</td>\n",
       "      <td>0.015833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 12:00:00</th>\n",
       "      <td>0.091667</td>\n",
       "      <td>0.088250</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 15:00:00</th>\n",
       "      <td>0.125000</td>\n",
       "      <td>0.084667</td>\n",
       "      <td>0.016500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03 18:00:00</th>\n",
       "      <td>0.121583</td>\n",
       "      <td>0.082083</td>\n",
       "      <td>0.015833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 09:00:00</th>\n",
       "      <td>0.109000</td>\n",
       "      <td>0.105167</td>\n",
       "      <td>0.018000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 12:00:00</th>\n",
       "      <td>0.157417</td>\n",
       "      <td>0.110750</td>\n",
       "      <td>0.018417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 15:00:00</th>\n",
       "      <td>0.160417</td>\n",
       "      <td>0.113750</td>\n",
       "      <td>0.018417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04 18:00:00</th>\n",
       "      <td>0.155583</td>\n",
       "      <td>0.109083</td>\n",
       "      <td>0.018000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05 09:00:00</th>\n",
       "      <td>0.161500</td>\n",
       "      <td>0.114583</td>\n",
       "      <td>0.021583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05 12:00:00</th>\n",
       "      <td>0.115667</td>\n",
       "      <td>0.111750</td>\n",
       "      <td>0.020167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05 15:00:00</th>\n",
       "      <td>0.146000</td>\n",
       "      <td>0.100750</td>\n",
       "      <td>0.019500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05 18:00:00</th>\n",
       "      <td>0.101500</td>\n",
       "      <td>0.097667</td>\n",
       "      <td>0.017250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-06 09:00:00</th>\n",
       "      <td>0.100083</td>\n",
       "      <td>0.065583</td>\n",
       "      <td>0.015500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-06 12:00:00</th>\n",
       "      <td>0.122667</td>\n",
       "      <td>0.082917</td>\n",
       "      <td>0.017333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-06 15:00:00</th>\n",
       "      <td>0.120250</td>\n",
       "      <td>0.080583</td>\n",
       "      <td>0.017417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-06 18:00:00</th>\n",
       "      <td>0.049250</td>\n",
       "      <td>0.047250</td>\n",
       "      <td>0.013167</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-07 09:00:00</th>\n",
       "      <td>0.138500</td>\n",
       "      <td>0.093917</td>\n",
       "      <td>0.015000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-07 12:00:00</th>\n",
       "      <td>0.139250</td>\n",
       "      <td>0.094667</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-07 15:00:00</th>\n",
       "      <td>0.127250</td>\n",
       "      <td>0.086417</td>\n",
       "      <td>0.015917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-07 18:00:00</th>\n",
       "      <td>0.118417</td>\n",
       "      <td>0.079583</td>\n",
       "      <td>0.014833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-08 09:00:00</th>\n",
       "      <td>0.101333</td>\n",
       "      <td>0.066417</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-08 12:00:00</th>\n",
       "      <td>0.115167</td>\n",
       "      <td>0.077000</td>\n",
       "      <td>0.014917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-25 15:00:00</th>\n",
       "      <td>1.392500</td>\n",
       "      <td>1.392500</td>\n",
       "      <td>0.238583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-25 18:00:00</th>\n",
       "      <td>3.360000</td>\n",
       "      <td>3.360000</td>\n",
       "      <td>0.331333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-26 09:00:00</th>\n",
       "      <td>1.354167</td>\n",
       "      <td>1.354167</td>\n",
       "      <td>0.127583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-26 12:00:00</th>\n",
       "      <td>1.459167</td>\n",
       "      <td>1.459167</td>\n",
       "      <td>0.108333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-26 15:00:00</th>\n",
       "      <td>1.310000</td>\n",
       "      <td>1.310000</td>\n",
       "      <td>0.100833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-26 18:00:00</th>\n",
       "      <td>1.016417</td>\n",
       "      <td>1.016417</td>\n",
       "      <td>0.103083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-27 09:00:00</th>\n",
       "      <td>1.076667</td>\n",
       "      <td>1.076667</td>\n",
       "      <td>0.103000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-27 12:00:00</th>\n",
       "      <td>1.244167</td>\n",
       "      <td>1.244167</td>\n",
       "      <td>0.195417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-27 15:00:00</th>\n",
       "      <td>2.048333</td>\n",
       "      <td>2.048333</td>\n",
       "      <td>0.210000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-27 18:00:00</th>\n",
       "      <td>2.550000</td>\n",
       "      <td>2.550000</td>\n",
       "      <td>0.200000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-28 09:00:00</th>\n",
       "      <td>0.961500</td>\n",
       "      <td>0.961500</td>\n",
       "      <td>0.092417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-28 12:00:00</th>\n",
       "      <td>0.888417</td>\n",
       "      <td>0.888417</td>\n",
       "      <td>0.115917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-28 15:00:00</th>\n",
       "      <td>1.346667</td>\n",
       "      <td>1.346667</td>\n",
       "      <td>0.144333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-28 18:00:00</th>\n",
       "      <td>1.373333</td>\n",
       "      <td>1.373333</td>\n",
       "      <td>0.110417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-29 09:00:00</th>\n",
       "      <td>0.786833</td>\n",
       "      <td>0.786833</td>\n",
       "      <td>0.077000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-29 12:00:00</th>\n",
       "      <td>0.723750</td>\n",
       "      <td>0.723750</td>\n",
       "      <td>0.072667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-29 15:00:00</th>\n",
       "      <td>0.690667</td>\n",
       "      <td>0.690667</td>\n",
       "      <td>0.069667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-29 18:00:00</th>\n",
       "      <td>0.663417</td>\n",
       "      <td>0.663417</td>\n",
       "      <td>0.069667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-30 09:00:00</th>\n",
       "      <td>0.916000</td>\n",
       "      <td>0.916000</td>\n",
       "      <td>0.101583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-30 12:00:00</th>\n",
       "      <td>1.465000</td>\n",
       "      <td>1.465000</td>\n",
       "      <td>0.086833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-30 15:00:00</th>\n",
       "      <td>1.314167</td>\n",
       "      <td>1.314167</td>\n",
       "      <td>0.085417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-30 18:00:00</th>\n",
       "      <td>1.239167</td>\n",
       "      <td>1.239167</td>\n",
       "      <td>0.098083</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-31 09:00:00</th>\n",
       "      <td>0.682750</td>\n",
       "      <td>0.682750</td>\n",
       "      <td>0.066583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-31 12:00:00</th>\n",
       "      <td>0.651250</td>\n",
       "      <td>0.651250</td>\n",
       "      <td>0.063833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-31 15:00:00</th>\n",
       "      <td>0.629000</td>\n",
       "      <td>0.629000</td>\n",
       "      <td>0.061833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-12-31 18:00:00</th>\n",
       "      <td>0.617333</td>\n",
       "      <td>0.617333</td>\n",
       "      <td>0.060583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 09:00:00</th>\n",
       "      <td>2.055000</td>\n",
       "      <td>2.055000</td>\n",
       "      <td>0.175667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 12:00:00</th>\n",
       "      <td>1.710000</td>\n",
       "      <td>1.710000</td>\n",
       "      <td>0.129583</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 15:00:00</th>\n",
       "      <td>1.420000</td>\n",
       "      <td>1.420000</td>\n",
       "      <td>0.096333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2013-01-01 18:00:00</th>\n",
       "      <td>1.178583</td>\n",
       "      <td>1.178583</td>\n",
       "      <td>0.083083</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5848 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2009-01-01 09:00:00  0.135750  0.091500  0.016250\n",
       "2009-01-01 12:00:00  0.140917  0.096167  0.017000\n",
       "2009-01-01 15:00:00  0.099167  0.091667  0.017583\n",
       "2009-01-01 18:00:00  0.132667  0.090167  0.016250\n",
       "2009-01-02 09:00:00  0.141917  0.097083  0.016417\n",
       "2009-01-02 12:00:00  0.147833  0.101917  0.016417\n",
       "2009-01-02 15:00:00  0.107917  0.100250  0.016417\n",
       "2009-01-02 18:00:00  0.143583  0.098417  0.016750\n",
       "2009-01-03 09:00:00  0.124583  0.084417  0.015833\n",
       "2009-01-03 12:00:00  0.091667  0.088250  0.016250\n",
       "2009-01-03 15:00:00  0.125000  0.084667  0.016500\n",
       "2009-01-03 18:00:00  0.121583  0.082083  0.015833\n",
       "2009-01-04 09:00:00  0.109000  0.105167  0.018000\n",
       "2009-01-04 12:00:00  0.157417  0.110750  0.018417\n",
       "2009-01-04 15:00:00  0.160417  0.113750  0.018417\n",
       "2009-01-04 18:00:00  0.155583  0.109083  0.018000\n",
       "2009-01-05 09:00:00  0.161500  0.114583  0.021583\n",
       "2009-01-05 12:00:00  0.115667  0.111750  0.020167\n",
       "2009-01-05 15:00:00  0.146000  0.100750  0.019500\n",
       "2009-01-05 18:00:00  0.101500  0.097667  0.017250\n",
       "2009-01-06 09:00:00  0.100083  0.065583  0.015500\n",
       "2009-01-06 12:00:00  0.122667  0.082917  0.017333\n",
       "2009-01-06 15:00:00  0.120250  0.080583  0.017417\n",
       "2009-01-06 18:00:00  0.049250  0.047250  0.013167\n",
       "2009-01-07 09:00:00  0.138500  0.093917  0.015000\n",
       "2009-01-07 12:00:00  0.139250  0.094667  0.016417\n",
       "2009-01-07 15:00:00  0.127250  0.086417  0.015917\n",
       "2009-01-07 18:00:00  0.118417  0.079583  0.014833\n",
       "2009-01-08 09:00:00  0.101333  0.066417  0.016833\n",
       "2009-01-08 12:00:00  0.115167  0.077000  0.014917\n",
       "...                       ...       ...       ...\n",
       "2012-12-25 15:00:00  1.392500  1.392500  0.238583\n",
       "2012-12-25 18:00:00  3.360000  3.360000  0.331333\n",
       "2012-12-26 09:00:00  1.354167  1.354167  0.127583\n",
       "2012-12-26 12:00:00  1.459167  1.459167  0.108333\n",
       "2012-12-26 15:00:00  1.310000  1.310000  0.100833\n",
       "2012-12-26 18:00:00  1.016417  1.016417  0.103083\n",
       "2012-12-27 09:00:00  1.076667  1.076667  0.103000\n",
       "2012-12-27 12:00:00  1.244167  1.244167  0.195417\n",
       "2012-12-27 15:00:00  2.048333  2.048333  0.210000\n",
       "2012-12-27 18:00:00  2.550000  2.550000  0.200000\n",
       "2012-12-28 09:00:00  0.961500  0.961500  0.092417\n",
       "2012-12-28 12:00:00  0.888417  0.888417  0.115917\n",
       "2012-12-28 15:00:00  1.346667  1.346667  0.144333\n",
       "2012-12-28 18:00:00  1.373333  1.373333  0.110417\n",
       "2012-12-29 09:00:00  0.786833  0.786833  0.077000\n",
       "2012-12-29 12:00:00  0.723750  0.723750  0.072667\n",
       "2012-12-29 15:00:00  0.690667  0.690667  0.069667\n",
       "2012-12-29 18:00:00  0.663417  0.663417  0.069667\n",
       "2012-12-30 09:00:00  0.916000  0.916000  0.101583\n",
       "2012-12-30 12:00:00  1.465000  1.465000  0.086833\n",
       "2012-12-30 15:00:00  1.314167  1.314167  0.085417\n",
       "2012-12-30 18:00:00  1.239167  1.239167  0.098083\n",
       "2012-12-31 09:00:00  0.682750  0.682750  0.066583\n",
       "2012-12-31 12:00:00  0.651250  0.651250  0.063833\n",
       "2012-12-31 15:00:00  0.629000  0.629000  0.061833\n",
       "2012-12-31 18:00:00  0.617333  0.617333  0.060583\n",
       "2013-01-01 09:00:00  2.055000  2.055000  0.175667\n",
       "2013-01-01 12:00:00  1.710000  1.710000  0.129583\n",
       "2013-01-01 15:00:00  1.420000  1.420000  0.096333\n",
       "2013-01-01 18:00:00  1.178583  1.178583  0.083083\n",
       "\n",
       "[5848 rows x 3 columns]"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#两者之间[默认的情况他会加载index上面]\n",
    "data.between_time(\"8:00\",\"19:00\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 时间序列重操作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01 00:00:00</th>\n",
       "      <td>0.137417</td>\n",
       "      <td>0.097500</td>\n",
       "      <td>0.016833</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 03:00:00</th>\n",
       "      <td>0.131250</td>\n",
       "      <td>0.088833</td>\n",
       "      <td>0.016417</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 06:00:00</th>\n",
       "      <td>0.113500</td>\n",
       "      <td>0.091250</td>\n",
       "      <td>0.016750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 09:00:00</th>\n",
       "      <td>0.135750</td>\n",
       "      <td>0.091500</td>\n",
       "      <td>0.016250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-01 12:00:00</th>\n",
       "      <td>0.140917</td>\n",
       "      <td>0.096167</td>\n",
       "      <td>0.017000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      L06_347  LS06_347  LS06_348\n",
       "Time                                             \n",
       "2009-01-01 00:00:00  0.137417  0.097500  0.016833\n",
       "2009-01-01 03:00:00  0.131250  0.088833  0.016417\n",
       "2009-01-01 06:00:00  0.113500  0.091250  0.016750\n",
       "2009-01-01 09:00:00  0.135750  0.091500  0.016250\n",
       "2009-01-01 12:00:00  0.140917  0.096167  0.017000"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#按照什么方式生成时间序列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01</th>\n",
       "      <td>0.125010</td>\n",
       "      <td>0.092281</td>\n",
       "      <td>0.016635</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02</th>\n",
       "      <td>0.124146</td>\n",
       "      <td>0.095781</td>\n",
       "      <td>0.016406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03</th>\n",
       "      <td>0.113562</td>\n",
       "      <td>0.085542</td>\n",
       "      <td>0.016094</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04</th>\n",
       "      <td>0.140198</td>\n",
       "      <td>0.102708</td>\n",
       "      <td>0.017323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05</th>\n",
       "      <td>0.128812</td>\n",
       "      <td>0.104490</td>\n",
       "      <td>0.018167</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             L06_347  LS06_347  LS06_348\n",
       "Time                                    \n",
       "2009-01-01  0.125010  0.092281  0.016635\n",
       "2009-01-02  0.124146  0.095781  0.016406\n",
       "2009-01-03  0.113562  0.085542  0.016094\n",
       "2009-01-04  0.140198  0.102708  0.017323\n",
       "2009-01-05  0.128812  0.104490  0.018167"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.resample('D').mean().head()#按天生成时间序列【默认情况生成是期望值】"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\sorfware_install\\python_install\\lib\\site-packages\\ipykernel_launcher.py:1: FutureWarning: how in .resample() is deprecated\n",
      "the new syntax is .resample(...).mean()\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01</th>\n",
       "      <td>0.125010</td>\n",
       "      <td>0.092281</td>\n",
       "      <td>0.016635</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-02</th>\n",
       "      <td>0.124146</td>\n",
       "      <td>0.095781</td>\n",
       "      <td>0.016406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-03</th>\n",
       "      <td>0.113562</td>\n",
       "      <td>0.085542</td>\n",
       "      <td>0.016094</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04</th>\n",
       "      <td>0.140198</td>\n",
       "      <td>0.102708</td>\n",
       "      <td>0.017323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-05</th>\n",
       "      <td>0.128812</td>\n",
       "      <td>0.104490</td>\n",
       "      <td>0.018167</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             L06_347  LS06_347  LS06_348\n",
       "Time                                    \n",
       "2009-01-01  0.125010  0.092281  0.016635\n",
       "2009-01-02  0.124146  0.095781  0.016406\n",
       "2009-01-03  0.113562  0.085542  0.016094\n",
       "2009-01-04  0.140198  0.102708  0.017323\n",
       "2009-01-05  0.128812  0.104490  0.018167"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.resample('D',how='mean').head() \n",
    "#这种方式不提倡使用的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 如果按照3天生成序列呢"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-01</th>\n",
       "      <td>0.120906</td>\n",
       "      <td>0.091201</td>\n",
       "      <td>0.016378</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-04</th>\n",
       "      <td>0.121594</td>\n",
       "      <td>0.091708</td>\n",
       "      <td>0.016670</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-07</th>\n",
       "      <td>0.097042</td>\n",
       "      <td>0.070740</td>\n",
       "      <td>0.014479</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-10</th>\n",
       "      <td>0.115941</td>\n",
       "      <td>0.086340</td>\n",
       "      <td>0.014545</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-01-13</th>\n",
       "      <td>0.346962</td>\n",
       "      <td>0.364549</td>\n",
       "      <td>0.034198</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             L06_347  LS06_347  LS06_348\n",
       "Time                                    \n",
       "2009-01-01  0.120906  0.091201  0.016378\n",
       "2009-01-04  0.121594  0.091708  0.016670\n",
       "2009-01-07  0.097042  0.070740  0.014479\n",
       "2009-01-10  0.115941  0.086340  0.014545\n",
       "2009-01-13  0.346962  0.364549  0.034198"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.resample('3D').mean().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#按月生成序列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>L06_347</th>\n",
       "      <th>LS06_347</th>\n",
       "      <th>LS06_348</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Time</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2009-01-31</th>\n",
       "      <td>0.517864</td>\n",
       "      <td>0.536660</td>\n",
       "      <td>0.045597</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-02-28</th>\n",
       "      <td>0.516847</td>\n",
       "      <td>0.529987</td>\n",
       "      <td>0.047238</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-03-31</th>\n",
       "      <td>0.373157</td>\n",
       "      <td>0.383172</td>\n",
       "      <td>0.037508</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-04-30</th>\n",
       "      <td>0.163182</td>\n",
       "      <td>0.129354</td>\n",
       "      <td>0.021356</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2009-05-31</th>\n",
       "      <td>0.178588</td>\n",
       "      <td>0.160616</td>\n",
       "      <td>0.020744</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             L06_347  LS06_347  LS06_348\n",
       "Time                                    \n",
       "2009-01-31  0.517864  0.536660  0.045597\n",
       "2009-02-28  0.516847  0.529987  0.047238\n",
       "2009-03-31  0.373157  0.383172  0.037508\n",
       "2009-04-30  0.163182  0.129354  0.021356\n",
       "2009-05-31  0.178588  0.160616  0.020744"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.resample('M').mean().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#将数据转为图像"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "/* Put everything inside the global mpl namespace */\n",
       "window.mpl = {};\n",
       "\n",
       "\n",
       "mpl.get_websocket_type = function() {\n",
       "    if (typeof(WebSocket) !== 'undefined') {\n",
       "        return WebSocket;\n",
       "    } else if (typeof(MozWebSocket) !== 'undefined') {\n",
       "        return MozWebSocket;\n",
       "    } else {\n",
       "        alert('Your browser does not have WebSocket support.' +\n",
       "              'Please try Chrome, Safari or Firefox ≥ 6. ' +\n",
       "              'Firefox 4 and 5 are also supported but you ' +\n",
       "              'have to enable WebSockets in about:config.');\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n",
       "    this.id = figure_id;\n",
       "\n",
       "    this.ws = websocket;\n",
       "\n",
       "    this.supports_binary = (this.ws.binaryType != undefined);\n",
       "\n",
       "    if (!this.supports_binary) {\n",
       "        var warnings = document.getElementById(\"mpl-warnings\");\n",
       "        if (warnings) {\n",
       "            warnings.style.display = 'block';\n",
       "            warnings.textContent = (\n",
       "                \"This browser does not support binary websocket messages. \" +\n",
       "                    \"Performance may be slow.\");\n",
       "        }\n",
       "    }\n",
       "\n",
       "    this.imageObj = new Image();\n",
       "\n",
       "    this.context = undefined;\n",
       "    this.message = undefined;\n",
       "    this.canvas = undefined;\n",
       "    this.rubberband_canvas = undefined;\n",
       "    this.rubberband_context = undefined;\n",
       "    this.format_dropdown = undefined;\n",
       "\n",
       "    this.image_mode = 'full';\n",
       "\n",
       "    this.root = $('<div/>');\n",
       "    this._root_extra_style(this.root)\n",
       "    this.root.attr('style', 'display: inline-block');\n",
       "\n",
       "    $(parent_element).append(this.root);\n",
       "\n",
       "    this._init_header(this);\n",
       "    this._init_canvas(this);\n",
       "    this._init_toolbar(this);\n",
       "\n",
       "    var fig = this;\n",
       "\n",
       "    this.waiting = false;\n",
       "\n",
       "    this.ws.onopen =  function () {\n",
       "            fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n",
       "            fig.send_message(\"send_image_mode\", {});\n",
       "            if (mpl.ratio != 1) {\n",
       "                fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n",
       "            }\n",
       "            fig.send_message(\"refresh\", {});\n",
       "        }\n",
       "\n",
       "    this.imageObj.onload = function() {\n",
       "            if (fig.image_mode == 'full') {\n",
       "                // Full images could contain transparency (where diff images\n",
       "                // almost always do), so we need to clear the canvas so that\n",
       "                // there is no ghosting.\n",
       "                fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n",
       "            }\n",
       "            fig.context.drawImage(fig.imageObj, 0, 0);\n",
       "        };\n",
       "\n",
       "    this.imageObj.onunload = function() {\n",
       "        fig.ws.close();\n",
       "    }\n",
       "\n",
       "    this.ws.onmessage = this._make_on_message_function(this);\n",
       "\n",
       "    this.ondownload = ondownload;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_header = function() {\n",
       "    var titlebar = $(\n",
       "        '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n",
       "        'ui-helper-clearfix\"/>');\n",
       "    var titletext = $(\n",
       "        '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n",
       "        'text-align: center; padding: 3px;\"/>');\n",
       "    titlebar.append(titletext)\n",
       "    this.root.append(titlebar);\n",
       "    this.header = titletext[0];\n",
       "}\n",
       "\n",
       "\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_canvas = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var canvas_div = $('<div/>');\n",
       "\n",
       "    canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n",
       "\n",
       "    function canvas_keyboard_event(event) {\n",
       "        return fig.key_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    canvas_div.keydown('key_press', canvas_keyboard_event);\n",
       "    canvas_div.keyup('key_release', canvas_keyboard_event);\n",
       "    this.canvas_div = canvas_div\n",
       "    this._canvas_extra_style(canvas_div)\n",
       "    this.root.append(canvas_div);\n",
       "\n",
       "    var canvas = $('<canvas/>');\n",
       "    canvas.addClass('mpl-canvas');\n",
       "    canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n",
       "\n",
       "    this.canvas = canvas[0];\n",
       "    this.context = canvas[0].getContext(\"2d\");\n",
       "\n",
       "    var backingStore = this.context.backingStorePixelRatio ||\n",
       "\tthis.context.webkitBackingStorePixelRatio ||\n",
       "\tthis.context.mozBackingStorePixelRatio ||\n",
       "\tthis.context.msBackingStorePixelRatio ||\n",
       "\tthis.context.oBackingStorePixelRatio ||\n",
       "\tthis.context.backingStorePixelRatio || 1;\n",
       "\n",
       "    mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n",
       "\n",
       "    var rubberband = $('<canvas/>');\n",
       "    rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n",
       "\n",
       "    var pass_mouse_events = true;\n",
       "\n",
       "    canvas_div.resizable({\n",
       "        start: function(event, ui) {\n",
       "            pass_mouse_events = false;\n",
       "        },\n",
       "        resize: function(event, ui) {\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "        stop: function(event, ui) {\n",
       "            pass_mouse_events = true;\n",
       "            fig.request_resize(ui.size.width, ui.size.height);\n",
       "        },\n",
       "    });\n",
       "\n",
       "    function mouse_event_fn(event) {\n",
       "        if (pass_mouse_events)\n",
       "            return fig.mouse_event(event, event['data']);\n",
       "    }\n",
       "\n",
       "    rubberband.mousedown('button_press', mouse_event_fn);\n",
       "    rubberband.mouseup('button_release', mouse_event_fn);\n",
       "    // Throttle sequential mouse events to 1 every 20ms.\n",
       "    rubberband.mousemove('motion_notify', mouse_event_fn);\n",
       "\n",
       "    rubberband.mouseenter('figure_enter', mouse_event_fn);\n",
       "    rubberband.mouseleave('figure_leave', mouse_event_fn);\n",
       "\n",
       "    canvas_div.on(\"wheel\", function (event) {\n",
       "        event = event.originalEvent;\n",
       "        event['data'] = 'scroll'\n",
       "        if (event.deltaY < 0) {\n",
       "            event.step = 1;\n",
       "        } else {\n",
       "            event.step = -1;\n",
       "        }\n",
       "        mouse_event_fn(event);\n",
       "    });\n",
       "\n",
       "    canvas_div.append(canvas);\n",
       "    canvas_div.append(rubberband);\n",
       "\n",
       "    this.rubberband = rubberband;\n",
       "    this.rubberband_canvas = rubberband[0];\n",
       "    this.rubberband_context = rubberband[0].getContext(\"2d\");\n",
       "    this.rubberband_context.strokeStyle = \"#000000\";\n",
       "\n",
       "    this._resize_canvas = function(width, height) {\n",
       "        // Keep the size of the canvas, canvas container, and rubber band\n",
       "        // canvas in synch.\n",
       "        canvas_div.css('width', width)\n",
       "        canvas_div.css('height', height)\n",
       "\n",
       "        canvas.attr('width', width * mpl.ratio);\n",
       "        canvas.attr('height', height * mpl.ratio);\n",
       "        canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n",
       "\n",
       "        rubberband.attr('width', width);\n",
       "        rubberband.attr('height', height);\n",
       "    }\n",
       "\n",
       "    // Set the figure to an initial 600x600px, this will subsequently be updated\n",
       "    // upon first draw.\n",
       "    this._resize_canvas(600, 600);\n",
       "\n",
       "    // Disable right mouse context menu.\n",
       "    $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n",
       "        return false;\n",
       "    });\n",
       "\n",
       "    function set_focus () {\n",
       "        canvas.focus();\n",
       "        canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    window.setTimeout(set_focus, 100);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>')\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items) {\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) {\n",
       "            // put a spacer in here.\n",
       "            continue;\n",
       "        }\n",
       "        var button = $('<button/>');\n",
       "        button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n",
       "                        'ui-button-icon-only');\n",
       "        button.attr('role', 'button');\n",
       "        button.attr('aria-disabled', 'false');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "\n",
       "        var icon_img = $('<span/>');\n",
       "        icon_img.addClass('ui-button-icon-primary ui-icon');\n",
       "        icon_img.addClass(image);\n",
       "        icon_img.addClass('ui-corner-all');\n",
       "\n",
       "        var tooltip_span = $('<span/>');\n",
       "        tooltip_span.addClass('ui-button-text');\n",
       "        tooltip_span.html(tooltip);\n",
       "\n",
       "        button.append(icon_img);\n",
       "        button.append(tooltip_span);\n",
       "\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    var fmt_picker_span = $('<span/>');\n",
       "\n",
       "    var fmt_picker = $('<select/>');\n",
       "    fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n",
       "    fmt_picker_span.append(fmt_picker);\n",
       "    nav_element.append(fmt_picker_span);\n",
       "    this.format_dropdown = fmt_picker[0];\n",
       "\n",
       "    for (var ind in mpl.extensions) {\n",
       "        var fmt = mpl.extensions[ind];\n",
       "        var option = $(\n",
       "            '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n",
       "        fmt_picker.append(option)\n",
       "    }\n",
       "\n",
       "    // Add hover states to the ui-buttons\n",
       "    $( \".ui-button\" ).hover(\n",
       "        function() { $(this).addClass(\"ui-state-hover\");},\n",
       "        function() { $(this).removeClass(\"ui-state-hover\");}\n",
       "    );\n",
       "\n",
       "    var status_bar = $('<span class=\"mpl-message\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n",
       "    // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n",
       "    // which will in turn request a refresh of the image.\n",
       "    this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_message = function(type, properties) {\n",
       "    properties['type'] = type;\n",
       "    properties['figure_id'] = this.id;\n",
       "    this.ws.send(JSON.stringify(properties));\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.send_draw_message = function() {\n",
       "    if (!this.waiting) {\n",
       "        this.waiting = true;\n",
       "        this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n",
       "    }\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    var format_dropdown = fig.format_dropdown;\n",
       "    var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n",
       "    fig.ondownload(fig, format);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.figure.prototype.handle_resize = function(fig, msg) {\n",
       "    var size = msg['size'];\n",
       "    if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n",
       "        fig._resize_canvas(size[0], size[1]);\n",
       "        fig.send_message(\"refresh\", {});\n",
       "    };\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_rubberband = function(fig, msg) {\n",
       "    var x0 = msg['x0'] / mpl.ratio;\n",
       "    var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n",
       "    var x1 = msg['x1'] / mpl.ratio;\n",
       "    var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n",
       "    x0 = Math.floor(x0) + 0.5;\n",
       "    y0 = Math.floor(y0) + 0.5;\n",
       "    x1 = Math.floor(x1) + 0.5;\n",
       "    y1 = Math.floor(y1) + 0.5;\n",
       "    var min_x = Math.min(x0, x1);\n",
       "    var min_y = Math.min(y0, y1);\n",
       "    var width = Math.abs(x1 - x0);\n",
       "    var height = Math.abs(y1 - y0);\n",
       "\n",
       "    fig.rubberband_context.clearRect(\n",
       "        0, 0, fig.canvas.width, fig.canvas.height);\n",
       "\n",
       "    fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_figure_label = function(fig, msg) {\n",
       "    // Updates the figure title.\n",
       "    fig.header.textContent = msg['label'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_cursor = function(fig, msg) {\n",
       "    var cursor = msg['cursor'];\n",
       "    switch(cursor)\n",
       "    {\n",
       "    case 0:\n",
       "        cursor = 'pointer';\n",
       "        break;\n",
       "    case 1:\n",
       "        cursor = 'default';\n",
       "        break;\n",
       "    case 2:\n",
       "        cursor = 'crosshair';\n",
       "        break;\n",
       "    case 3:\n",
       "        cursor = 'move';\n",
       "        break;\n",
       "    }\n",
       "    fig.rubberband_canvas.style.cursor = cursor;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_message = function(fig, msg) {\n",
       "    fig.message.textContent = msg['message'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_draw = function(fig, msg) {\n",
       "    // Request the server to send over a new figure.\n",
       "    fig.send_draw_message();\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_image_mode = function(fig, msg) {\n",
       "    fig.image_mode = msg['mode'];\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Called whenever the canvas gets updated.\n",
       "    this.send_message(\"ack\", {});\n",
       "}\n",
       "\n",
       "// A function to construct a web socket function for onmessage handling.\n",
       "// Called in the figure constructor.\n",
       "mpl.figure.prototype._make_on_message_function = function(fig) {\n",
       "    return function socket_on_message(evt) {\n",
       "        if (evt.data instanceof Blob) {\n",
       "            /* FIXME: We get \"Resource interpreted as Image but\n",
       "             * transferred with MIME type text/plain:\" errors on\n",
       "             * Chrome.  But how to set the MIME type?  It doesn't seem\n",
       "             * to be part of the websocket stream */\n",
       "            evt.data.type = \"image/png\";\n",
       "\n",
       "            /* Free the memory for the previous frames */\n",
       "            if (fig.imageObj.src) {\n",
       "                (window.URL || window.webkitURL).revokeObjectURL(\n",
       "                    fig.imageObj.src);\n",
       "            }\n",
       "\n",
       "            fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n",
       "                evt.data);\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "        else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n",
       "            fig.imageObj.src = evt.data;\n",
       "            fig.updated_canvas_event();\n",
       "            fig.waiting = false;\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        var msg = JSON.parse(evt.data);\n",
       "        var msg_type = msg['type'];\n",
       "\n",
       "        // Call the  \"handle_{type}\" callback, which takes\n",
       "        // the figure and JSON message as its only arguments.\n",
       "        try {\n",
       "            var callback = fig[\"handle_\" + msg_type];\n",
       "        } catch (e) {\n",
       "            console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n",
       "            return;\n",
       "        }\n",
       "\n",
       "        if (callback) {\n",
       "            try {\n",
       "                // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n",
       "                callback(fig, msg);\n",
       "            } catch (e) {\n",
       "                console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n",
       "            }\n",
       "        }\n",
       "    };\n",
       "}\n",
       "\n",
       "// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\n",
       "mpl.findpos = function(e) {\n",
       "    //this section is from http://www.quirksmode.org/js/events_properties.html\n",
       "    var targ;\n",
       "    if (!e)\n",
       "        e = window.event;\n",
       "    if (e.target)\n",
       "        targ = e.target;\n",
       "    else if (e.srcElement)\n",
       "        targ = e.srcElement;\n",
       "    if (targ.nodeType == 3) // defeat Safari bug\n",
       "        targ = targ.parentNode;\n",
       "\n",
       "    // jQuery normalizes the pageX and pageY\n",
       "    // pageX,Y are the mouse positions relative to the document\n",
       "    // offset() returns the position of the element relative to the document\n",
       "    var x = e.pageX - $(targ).offset().left;\n",
       "    var y = e.pageY - $(targ).offset().top;\n",
       "\n",
       "    return {\"x\": x, \"y\": y};\n",
       "};\n",
       "\n",
       "/*\n",
       " * return a copy of an object with only non-object keys\n",
       " * we need this to avoid circular references\n",
       " * http://stackoverflow.com/a/24161582/3208463\n",
       " */\n",
       "function simpleKeys (original) {\n",
       "  return Object.keys(original).reduce(function (obj, key) {\n",
       "    if (typeof original[key] !== 'object')\n",
       "        obj[key] = original[key]\n",
       "    return obj;\n",
       "  }, {});\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.mouse_event = function(event, name) {\n",
       "    var canvas_pos = mpl.findpos(event)\n",
       "\n",
       "    if (name === 'button_press')\n",
       "    {\n",
       "        this.canvas.focus();\n",
       "        this.canvas_div.focus();\n",
       "    }\n",
       "\n",
       "    var x = canvas_pos.x * mpl.ratio;\n",
       "    var y = canvas_pos.y * mpl.ratio;\n",
       "\n",
       "    this.send_message(name, {x: x, y: y, button: event.button,\n",
       "                             step: event.step,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "\n",
       "    /* This prevents the web browser from automatically changing to\n",
       "     * the text insertion cursor when the button is pressed.  We want\n",
       "     * to control all of the cursor setting manually through the\n",
       "     * 'cursor' event from matplotlib */\n",
       "    event.preventDefault();\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    // Handle any extra behaviour associated with a key event\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.key_event = function(event, name) {\n",
       "\n",
       "    // Prevent repeat events\n",
       "    if (name == 'key_press')\n",
       "    {\n",
       "        if (event.which === this._key)\n",
       "            return;\n",
       "        else\n",
       "            this._key = event.which;\n",
       "    }\n",
       "    if (name == 'key_release')\n",
       "        this._key = null;\n",
       "\n",
       "    var value = '';\n",
       "    if (event.ctrlKey && event.which != 17)\n",
       "        value += \"ctrl+\";\n",
       "    if (event.altKey && event.which != 18)\n",
       "        value += \"alt+\";\n",
       "    if (event.shiftKey && event.which != 16)\n",
       "        value += \"shift+\";\n",
       "\n",
       "    value += 'k';\n",
       "    value += event.which.toString();\n",
       "\n",
       "    this._key_event_extra(event, name);\n",
       "\n",
       "    this.send_message(name, {key: value,\n",
       "                             guiEvent: simpleKeys(event)});\n",
       "    return false;\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onclick = function(name) {\n",
       "    if (name == 'download') {\n",
       "        this.handle_save(this, null);\n",
       "    } else {\n",
       "        this.send_message(\"toolbar_button\", {name: name});\n",
       "    }\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n",
       "    this.message.textContent = tooltip;\n",
       "};\n",
       "mpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to  previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n",
       "\n",
       "mpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n",
       "\n",
       "mpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n",
       "    // Create a \"websocket\"-like object which calls the given IPython comm\n",
       "    // object with the appropriate methods. Currently this is a non binary\n",
       "    // socket, so there is still some room for performance tuning.\n",
       "    var ws = {};\n",
       "\n",
       "    ws.close = function() {\n",
       "        comm.close()\n",
       "    };\n",
       "    ws.send = function(m) {\n",
       "        //console.log('sending', m);\n",
       "        comm.send(m);\n",
       "    };\n",
       "    // Register the callback with on_msg.\n",
       "    comm.on_msg(function(msg) {\n",
       "        //console.log('receiving', msg['content']['data'], msg);\n",
       "        // Pass the mpl event to the overriden (by mpl) onmessage function.\n",
       "        ws.onmessage(msg['content']['data'])\n",
       "    });\n",
       "    return ws;\n",
       "}\n",
       "\n",
       "mpl.mpl_figure_comm = function(comm, msg) {\n",
       "    // This is the function which gets called when the mpl process\n",
       "    // starts-up an IPython Comm through the \"matplotlib\" channel.\n",
       "\n",
       "    var id = msg.content.data.id;\n",
       "    // Get hold of the div created by the display call when the Comm\n",
       "    // socket was opened in Python.\n",
       "    var element = $(\"#\" + id);\n",
       "    var ws_proxy = comm_websocket_adapter(comm)\n",
       "\n",
       "    function ondownload(figure, format) {\n",
       "        window.open(figure.imageObj.src);\n",
       "    }\n",
       "\n",
       "    var fig = new mpl.figure(id, ws_proxy,\n",
       "                           ondownload,\n",
       "                           element.get(0));\n",
       "\n",
       "    // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n",
       "    // web socket which is closed, not our websocket->open comm proxy.\n",
       "    ws_proxy.onopen();\n",
       "\n",
       "    fig.parent_element = element.get(0);\n",
       "    fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n",
       "    if (!fig.cell_info) {\n",
       "        console.error(\"Failed to find cell for figure\", id, fig);\n",
       "        return;\n",
       "    }\n",
       "\n",
       "    var output_index = fig.cell_info[2]\n",
       "    var cell = fig.cell_info[0];\n",
       "\n",
       "};\n",
       "\n",
       "mpl.figure.prototype.handle_close = function(fig, msg) {\n",
       "    var width = fig.canvas.width/mpl.ratio\n",
       "    fig.root.unbind('remove')\n",
       "\n",
       "    // Update the output cell to use the data from the current canvas.\n",
       "    fig.push_to_output();\n",
       "    var dataURL = fig.canvas.toDataURL();\n",
       "    // Re-enable the keyboard manager in IPython - without this line, in FF,\n",
       "    // the notebook keyboard shortcuts fail.\n",
       "    IPython.keyboard_manager.enable()\n",
       "    $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n",
       "    fig.close_ws(fig, msg);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.close_ws = function(fig, msg){\n",
       "    fig.send_message('closing', msg);\n",
       "    // fig.ws.close()\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.push_to_output = function(remove_interactive) {\n",
       "    // Turn the data on the canvas into data in the output cell.\n",
       "    var width = this.canvas.width/mpl.ratio\n",
       "    var dataURL = this.canvas.toDataURL();\n",
       "    this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.updated_canvas_event = function() {\n",
       "    // Tell IPython that the notebook contents must change.\n",
       "    IPython.notebook.set_dirty(true);\n",
       "    this.send_message(\"ack\", {});\n",
       "    var fig = this;\n",
       "    // Wait a second, then push the new image to the DOM so\n",
       "    // that it is saved nicely (might be nice to debounce this).\n",
       "    setTimeout(function () { fig.push_to_output() }, 1000);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._init_toolbar = function() {\n",
       "    var fig = this;\n",
       "\n",
       "    var nav_element = $('<div/>')\n",
       "    nav_element.attr('style', 'width: 100%');\n",
       "    this.root.append(nav_element);\n",
       "\n",
       "    // Define a callback function for later on.\n",
       "    function toolbar_event(event) {\n",
       "        return fig.toolbar_button_onclick(event['data']);\n",
       "    }\n",
       "    function toolbar_mouse_event(event) {\n",
       "        return fig.toolbar_button_onmouseover(event['data']);\n",
       "    }\n",
       "\n",
       "    for(var toolbar_ind in mpl.toolbar_items){\n",
       "        var name = mpl.toolbar_items[toolbar_ind][0];\n",
       "        var tooltip = mpl.toolbar_items[toolbar_ind][1];\n",
       "        var image = mpl.toolbar_items[toolbar_ind][2];\n",
       "        var method_name = mpl.toolbar_items[toolbar_ind][3];\n",
       "\n",
       "        if (!name) { continue; };\n",
       "\n",
       "        var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n",
       "        button.click(method_name, toolbar_event);\n",
       "        button.mouseover(tooltip, toolbar_mouse_event);\n",
       "        nav_element.append(button);\n",
       "    }\n",
       "\n",
       "    // Add the status bar.\n",
       "    var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n",
       "    nav_element.append(status_bar);\n",
       "    this.message = status_bar[0];\n",
       "\n",
       "    // Add the close button to the window.\n",
       "    var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n",
       "    var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n",
       "    button.click(function (evt) { fig.handle_close(fig, {}); } );\n",
       "    button.mouseover('Stop Interaction', toolbar_mouse_event);\n",
       "    buttongrp.append(button);\n",
       "    var titlebar = this.root.find($('.ui-dialog-titlebar'));\n",
       "    titlebar.prepend(buttongrp);\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._root_extra_style = function(el){\n",
       "    var fig = this\n",
       "    el.on(\"remove\", function(){\n",
       "\tfig.close_ws(fig, {});\n",
       "    });\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._canvas_extra_style = function(el){\n",
       "    // this is important to make the div 'focusable\n",
       "    el.attr('tabindex', 0)\n",
       "    // reach out to IPython and tell the keyboard manager to turn it's self\n",
       "    // off when our div gets focus\n",
       "\n",
       "    // location in version 3\n",
       "    if (IPython.notebook.keyboard_manager) {\n",
       "        IPython.notebook.keyboard_manager.register_events(el);\n",
       "    }\n",
       "    else {\n",
       "        // location in version 2\n",
       "        IPython.keyboard_manager.register_events(el);\n",
       "    }\n",
       "\n",
       "}\n",
       "\n",
       "mpl.figure.prototype._key_event_extra = function(event, name) {\n",
       "    var manager = IPython.notebook.keyboard_manager;\n",
       "    if (!manager)\n",
       "        manager = IPython.keyboard_manager;\n",
       "\n",
       "    // Check for shift+enter\n",
       "    if (event.shiftKey && event.which == 13) {\n",
       "        this.canvas_div.blur();\n",
       "        event.shiftKey = false;\n",
       "        // Send a \"J\" for go to next cell\n",
       "        event.which = 74;\n",
       "        event.keyCode = 74;\n",
       "        manager.command_mode();\n",
       "        manager.handle_keydown(event);\n",
       "    }\n",
       "}\n",
       "\n",
       "mpl.figure.prototype.handle_save = function(fig, msg) {\n",
       "    fig.ondownload(fig, null);\n",
       "}\n",
       "\n",
       "\n",
       "mpl.find_output_cell = function(html_output) {\n",
       "    // Return the cell and output element which can be found *uniquely* in the notebook.\n",
       "    // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n",
       "    // IPython event is triggered only after the cells have been serialised, which for\n",
       "    // our purposes (turning an active figure into a static one), is too late.\n",
       "    var cells = IPython.notebook.get_cells();\n",
       "    var ncells = cells.length;\n",
       "    for (var i=0; i<ncells; i++) {\n",
       "        var cell = cells[i];\n",
       "        if (cell.cell_type === 'code'){\n",
       "            for (var j=0; j<cell.output_area.outputs.length; j++) {\n",
       "                var data = cell.output_area.outputs[j];\n",
       "                if (data.data) {\n",
       "                    // IPython >= 3 moved mimebundle to data attribute of output\n",
       "                    data = data.data;\n",
       "                }\n",
       "                if (data['text/html'] == html_output) {\n",
       "                    return [cell, data, j];\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    }\n",
       "}\n",
       "\n",
       "// Register the function which deals with the matplotlib target/channel.\n",
       "// The kernel may be null if the page has been refreshed.\n",
       "if (IPython.notebook.kernel != null) {\n",
       "    IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n",
       "}\n"
      ],
      "text/plain": [
       "<IPython.core.display.Javascript object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<img src=\"\" width=\"639.999974568686\">"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0xa3ebe80>"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.resample('M').mean().plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
